package com.gitee.mars.tourserver.controller;

import com.gitee.mars.tourserver.request.TourHotelRequest;
import com.gitee.mars.tourserver.response.result.R;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.springframework.web.bind.annotation.*;
import lombok.AllArgsConstructor;

import java.util.Arrays;

import com.gitee.mars.tourserver.entity.TourHotel;
import com.gitee.mars.tourserver.service.ITourHotelService;

/**
 * TourHotel 控制层
 *
 * @Author wq
 * @Date 2021-04-14
 **/
@RestController
@RequestMapping("/tourHotel")
@AllArgsConstructor
public class TourHotelController {

    private final ITourHotelService tourHotelService;

    /**
     * 获取hotel
     *
     * @return R
     * @throws BadHanyuPinyinOutputFormatCombination
     */
    @GetMapping("/acquire")
    public R acquire() throws BadHanyuPinyinOutputFormatCombination {
        tourHotelService.acquire();
        return R.success();
    }


    /**
     * 列表
     *
     * @param request request
     * @return R
     */
    @PostMapping("/list")
    public R list(@RequestBody TourHotelRequest request) {
        return R.success(tourHotelService.list(request));
    }

    @GetMapping("/detail")
    public R detail(Integer id) {
        return R.success(tourHotelService.detail(id));
    }


}